<template>
  <div class="page" style="">
    <div class="print_title">非项目付款合同详情 · 禾美环保</div>
    <p class="title">供方信息</p>
    <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >供应商名称:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyCompanName_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >公司地址:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyCompanyAddress }}</p>
          </a-col>
        </a-row>
      </a-col>

      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >委托代理人:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyEntrustedAgent }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >手机号码:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyPhoneNumber }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >开户银行:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyBankName }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >银行账号:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyBankAccountNo }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >纳税人识别号:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyRegistrationNumber }}</p>
          </a-col>
        </a-row>
      </a-col>
    </a-row>
    <p class="title" style="margin-top: 18px;">基本信息</p>
    <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >单据编号:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.purchaseBill }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >申请人:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.proposer_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >申请时间:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.createTime }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >申请部门:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.proposerDeptId_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >申请人所属团队:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.applyTeam_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >合同名称:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.contractName }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >采购类型:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.procurementType_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>

      <a-col :span="12" v-if="formData.procurementType == '1'">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.calibrationNo }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12" v-if="formData.procurementType == '2'">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.purchaseNo }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12" v-if="formData.procurementType == '3'">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >关联单据:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.invitationNo }}</p>
          </a-col>
        </a-row>
      </a-col>

      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >签订日期:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.signingDate }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >定点合同:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.isFixedTime_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12" v-if="formData.isFixedTime == 1">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >到期日期:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.expireTime }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >合同总额(元):</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.totalAmount }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >发票类型:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ filterMultiDictText(dictOptions['invoiceCategory'], formData.invoiceCategory + '') }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >税率(%):</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.taxRate }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >税费(元):</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.expensesTaxation }}</p>
          </a-col>
        </a-row>
      </a-col>
      <!--              迭代16.8：字段货期、运输方式、运输费承担方删除；-->
      <!-- <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >货期:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.deliveryTime }}{{ formData.deliveryTimeUnit_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >运输方式:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.modeTransportation_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >运输费承担方:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.trafficExpense_dictText }}</p>
          </a-col>
        </a-row>
      </a-col> -->

      <!--              迭代16.8：字段“关联团队”改为“费用所属团队”-->
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >费用所属团队:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.teamId_dictText?formData.teamId_dictText:formData.teamId }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >是否工程类:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.isEngineering_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>

      <!--              迭代16.8加入字段是否用印、印章类型、用印份数-->
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >是否用印:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.isUseSeal_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <template v-if="formData.isUseSeal && formData.isUseSeal == 1">
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >用印类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.signSealWay_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>

        <a-col :span="12" v-if="formData.isUseSeal == '1' && formData.signSealWay == 'online'">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >对方是否电子签章:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.isSignSeal_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.isSignSeal && formData.isSignSeal == 1">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >对方盖章人:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyPsnName }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12" v-if="formData.isSignSeal && formData.isSignSeal == 1">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >联系方式:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.supplyPsnMobile }}</p>
            </a-col>
          </a-row>
        </a-col>

        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >印章类型:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.sealType_dictText }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >用印份数:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.useSealNumber }}</p>
            </a-col>
          </a-row>
        </a-col>
      </template>
    </a-row>
    <!-- 附件信息 -->
    <!-- <FileInfor :purchaseFile="purchaseFile" title="招标文件" v-if="purchaseFile && purchaseFile.length"></FileInfor> -->

    <p class="title" style="margin-top: 18px;">需方信息</p>
    <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >公司名称:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandCompanName_dictText }}</p>
          </a-col>
        </a-row>
      </a-col>
      <template v-if="formData.isUseSeal == '1' && formData.signSealWay == 'online'">
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >我方经办人:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.psnName }}</p>
            </a-col>
          </a-row>
        </a-col>
        <a-col :span="12">
          <a-row style="margin-bottom: 0">
            <a-col style="display: flex;">
              <p style="margin-bottom: 0; white-space: nowrap" >联系方式:</p>
              <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.psnMobile }}</p>
            </a-col>
          </a-row>
        </a-col>
      </template>

      <!-- 迭代16.8： 删除字段公司地址、委托代理人、手机号码、开户银行、银行账号、纳税人识别号。-->
      <!-- <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >公司地址:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandCompanyAddress }}</p>
          </a-col>
        </a-row>
      </a-col>

      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >委托代理人:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandEntrustedAgent }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >手机号码:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandPhoneNumber }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >开户银行:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandBankName }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >银行账号:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandBankAccountNo }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >纳税人识别号:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.demandRegistrationNumber }}</p>
          </a-col>
        </a-row>
      </a-col> -->
    </a-row>

    <!-- 迭代16.8： 交接信息：字段全部删除 -->
    <!-- <p class="title" style="margin-top: 18px;">交接信息</p>
    <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
      <a-col :span="12">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >交货地址:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.deliveryAddress }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >收货人:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.consignee }}</p>
          </a-col>
        </a-row>
      </a-col>

      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >收货人电话:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.phoneNumber }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >发票邮寄地址:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.invoiceAddress }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >发票收件人:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.invoiceConsignee }}</p>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="12">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >发票收货人电话:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.invoiceNumber }}</p>
          </a-col>
        </a-row>
      </a-col>
    </a-row> -->
    <p class="title" style="margin-top: 18px;">其他信息</p>
    <a-row type="flex" justify="start" class="content" style="padding: 0 9px;">
      <!-- 迭代16.8：其他信息：（删除）删除验收条款 -->
      <!-- <a-col :span="24">
        <a-row style="margin-bottom: 0">
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >验收条款:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.inspectionClaus }}</p>
          </a-col>
        </a-row>
      </a-col> -->
      <a-col :span="24">
        <a-row>
          <a-col style="display: flex;">
            <p style="margin-bottom: 0; white-space: nowrap" >备注:</p>
            <p style="margin:0 0 0 6px; word-break: break-all;">{{ formData.remark }}</p>
          </a-col>
        </a-row>
      </a-col>
    </a-row>
    <a-row type="flex" justify="center" v-if="dataSource && dataSource.length">
      <a-col>
        <p class="title_table">付款信息</p>
      </a-col>
      <a-col :span="24">
        <p style="float:right">合同总额：{{ totalMoney }}元</p>
      </a-col>
      <a-col :span="24">
        <a-table
          :columns="columns"
          :data-source="dataSource"
          bordered
          :pagination="false"
          size="small"
          :rowClassName="tableRowClass"></a-table>
      </a-col>
    </a-row>
    <a-row type="flex" justify="center" v-if="dataSource1 && dataSource1.length" style="margin-top: 18px;">
      <a-col>
        <p class="title_table">物料信息</p>
      </a-col>
      <a-col :span="24">
        <a-table
          :columns="columns1"
          :data-source="dataSource1"
          bordered
          :pagination="false"
          size="small"
          :rowClassName="tableRowClass"></a-table>
      </a-col>
    </a-row>
    <!-- 附件信息 -->
    <FileInfor :purchaseFile="signFile" title="用印文件" v-if="signFile && signFile.length && formData.isUseSeal && formData.isUseSeal == 1"></FileInfor>
    <FileInfor :purchaseFile="contractOrgFile" title="合同原件扫描件" v-if="contractOrgFile && contractOrgFile.length"></FileInfor>
    <FileInfor :purchaseFile="purchaseFile" title="相关附件" v-if="purchaseFile && purchaseFile.length"></FileInfor>

    <!-- 流程详情 -->
    <ProcessInfor v-if="formData.bpmStatus !== '1'" :dataHistorySource="dataHistorySource"></ProcessInfor>
  </div>
</template>
<script>
import { getAction } from '@/api/manage'
import FileInfor from '@/components/print/FileInfor.vue' // 审批历史流程列表组件
import ProcessInfor from '@/components/print/ProcessInfor.vue' // 审批历史流程列表组件
import address from '@/components/AddressChoice/address.js'
import { filterMultiDictText, initDictOptions } from '@/components/dict/JDictSelectUtil'
export default {
	props: {
		formData: {
			type: Object,
			default: () => {},
			required: true
    },
		formDataHistory: {
			type: Object,
			default: () => {},
			required: true
    }
	},
  components: {
    FileInfor,
    ProcessInfor
  },
  data() {
    return {
      address,
      filterMultiDictText,
      dictOptions: {},
      dataSource: [], // 物料列表
      columns: [
      {
            title: '序号',
            dataIndex: '',
            key: 'rowIndex',
            width: 45,
            align: 'center',
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '合同款项',
            align: 'center',
            width: 90,
            dataIndex: 'contractPayment',
            customRender: (text) => {
              if (!text) {
                return ''
              } else {
                return filterMultiDictText(this.dictOptions['contractPayment'], text + '')
              }
            }
          },
          {
            title: '付款比例(%)',
            align: 'center',
            width: 90,
            dataIndex: 'ratioPayment',
            customRender: (text) => {
              if (!text) {
                return ''
              } else {
                return text + '%'
              }
            }
          },
          {
            title: '付款金额(元)',
            align: 'center',
            width: 90,
            dataIndex: 'paymentAmount'
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'remark'
          }
			],

      dataSource1: [], // 印章列表
        columns1: [
          {
            title: '序号',
            dataIndex: '',
            key: 'rowIndex',
            width: 45,
            align: 'center',
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '采购大类',
            align: 'center',
            width: 65,
            dataIndex: 'provisionBroad_dictText'
          },
          {
            title: '采购小类',
            align: 'center',
            width: 65,
            dataIndex: 'provisionSmall_dictText'
          },
          {
            title: '物料编号',
            align: 'center',
            width: 65,
            dataIndex: 'materialBillId'
          },
          {
            title: '物料名称',
            align: 'center',
            width: 65,
            dataIndex: 'materialName_dictText'
          },
          {
            title: '品牌',
            align: 'center',
            width: 45,
            dataIndex: 'brand'
          },
          {
            title: '规格型号',
            align: 'center',
            width: 65,
            dataIndex: 'specification'
          },
          {
            title: '单位',
            align: 'center',
            width: 45,
            dataIndex: 'unit_dictText'
          },
          {
            title: '数量',
            align: 'center',
            width: 45,
            dataIndex: 'amount'
          },
          {
            title: '单价(元)',
            align: 'center',
            width: 45,
            dataIndex: 'unitPrice'
          },
          {
            title: '总价(元)',
            align: 'center',
            dataIndex: 'totalPrices',
            customRender: function (t, r, index) {
              if (r.amount && r.unitPrice) {
                return (Number(r.amount) * Number(r.unitPrice)).toFixed(2)
              } else {
                return '0.00'
              }
            }
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'remark'
          }

        ],

			dataHistorySource: [], // 流程列表
			url: {
				list: '/api/erp/purchase/contract/erpPurchaseContractPayment/allList', // 物料明细列表
				suppliesList: '/api/erp/purchase/contract/erpPurchaseContractSupplies/allList',
				historyList: '/api/erpmng/act/task/processHistoryList', // 流程历史跟踪接口
        // 获取定标结果确认单信息
        queryCalibrationById: '/api/erp/purchase/procurement/erpPurchaseCalibration/queryById',
        // 获取采购申请单信息
        queryPurchaseApplyById: '/api/erp/purchase/procurement/erpPurchaseApplyForm/queryById',
        // 获取招标采购单信息
        queryInvitationById: '/api/erp/purchase/procurement/erpPurchaseApplyInvitation/queryById'
			},
			purchaseFile: [], // 附件
			signFile: [], // 附件
			contractOrgFile: [] // 附件
    };
  },

  computed: {
      totalMoney: function () {
        var money = 0
        // console.log('this.dataSource', this.dataSource)
        if (!!this.dataSource && this.dataSource.length) {
          this.dataSource.map(item => {
          money = money + item.paymentAmount
        })
        } else {
          money = 0
        }
        this.$emit('onTotalMoney', money)
        return money.toFixed(2)
      }
    },
	watch: {
		formData: {
			handler (val) {
				if (val) {
					this.list()
					this.getHistoryList()
          this.initDictConfig() // 字典值
          this.getBillId()
          if (val.associationBillId) {

          }
					if (val.purchaseFile) {
						this.purchaseFile = val.purchaseFile.split(',')
					}
					if (val.contractOrgFile) {
						this.contractOrgFile = val.contractOrgFile.split(',')
					}
					if (val.signFile) {
						this.signFile = val.signFile.split(',')
					}
				}
			},
			immediate: true
		},
		formDataHistory: {
			handler (val) {
				if (val) {
					this.getHistoryList()
				}
			},
			immediate: true
		}
	},
	methods: {
		// 获取列表
		getHistoryList() {
			var params = { processInstanceId: this.formDataHistory.procInsId };// 查询条件
			getAction(this.url.historyList, params).then(res => {
				if (res.success) {
					this.dataHistorySource = res.result.records || res.result
				}
			})
		},

    // 获取编号
    getBillId() {
      if (this.formData.associationBillId) {
        if (this.formData.procurementType === '1') {
          // 根据ID获取定标结果确认单单号 用于穿透
          getAction(this.url.queryCalibrationById, { id: this.formData.associationBillId }).then(res => {
            this.$set(this.formData, 'calibrationNo', res.result.purchaseBill);
          }).catch(e => {
            console.log(e)
          })
        } else if (this.formData.procurementType === '2') {
          // 根据ID获取采购申请单单号 用于穿透
          getAction(this.url.queryPurchaseApplyById, { id: this.formData.associationBillId }).then(res => {
            this.$set(this.formData, 'purchaseNo', res.result.purchaseBill);
          }).catch(e => {
            console.log(e)
          })
        } else if (this.formData.procurementType === '3') {
          // 根据ID获取招标采购单信息单号 用于穿透
          getAction(this.url.queryInvitationById, { id: this.formData.associationBillId }).then(res => {
            this.$set(this.formData, 'invitationNo', res.result.purchaseBill);
            }).catch(e => {
              console.log(e)
            })
        }
        }
    },

    initDictConfig() {
      // 合同款项
      initDictOptions('contract_payment').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'contractPayment', res.result)
        }
      })
      initDictOptions('invoice_type').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'invoiceCategory', res.result)
        }
      })
    },

		list () {
			if (!this.formData.id) {
				return false
			}
			var params = {
        billId: this.formData.id
			}
			getAction(this.url.list, params).then(res => {
				if (res.success) {
						this.dataSource = res.result.records || res.result
						this.dataSource.forEach((item, index) => {
						item.key = index
					})
				}
      })
			getAction(this.url.suppliesList, params).then(res => {
				if (res.success) {
						this.dataSource1 = res.result.records || res.result
						this.dataSource1.forEach((item, index) => {
						item.key = index
					})
				}
      })
		},

		tableRowClass(record, index) {
			console.log('record, index', record, index)
			if (index == 0) {
				return 'rowClass';
			}
      return ''
    },

    getAddress (text) {
      if (!text) {
        return false
      }
      var areaList = text.split(',')
      var areaText = ''
      this.address.map(value => {
        if (areaList[0] && areaList[0] == value.code) {
          areaText = areaText + value.name + '/'
          if (value && value.children && value.children.length) {
            value.children.map(val => {
              if (areaList[1] && areaList[1] == val.code) {
                areaText = areaText + val.name + '/'

                if (val && val.children && val.children.length) {
                  val.children.map(va => {
                    if (areaList[2] && areaList[2] == va.code) {
                      areaText = areaText + va.name
                    }
                  })
                }
              }
            })
          }
        }
      })
      return areaText
    }
	}
};
</script>
<style lang="less" scoped>
.page{
	background: #ffffff;
	padding: 19px 28px 0 28px;
	width: 750px;
	.print_title{
		font-size: 15px;
		font-family: Alibaba PuHuiTi 2.0;
		font-weight: normal;
		color: #000000;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 9px;
	}
	.title {
		background: #EEEEEE;
		font-size: 13px;
		font-family: Alibaba PuHuiTi 2.0;
		font-weight: normal;
		color: #000000;
		padding: 11px 9px;
	}
	.title_table{
		font-size: 13px;
		font-family: Alibaba PuHuiTi 2.0;
		font-weight: normal;
		color: #000000;
	}
}
/deep/ .rowClass{
	font-size: 10px;
	font-family: Alibaba PuHuiTi 2.0;
	font-weight: normal;
	color: #000000;
}
/deep/ .ant-table-thead th{
	font-size: 10px;
	font-family: Alibaba PuHuiTi 2.0;
	font-weight: normal;
	color: #000000;
}
/deep/ .ant-table-thead tr{
	background: #EEEEEE;
}
/deep/ .ant-table-small > .ant-table-content > .ant-table-body {
    margin: 0 0px;
}
/deep/ .ant-table-body tr {
	font-size: 10px;
	font-family: Alibaba PuHuiTi 2.0;
	font-weight: normal;
	color: #000000;
}
/deep/ .ant-table-body tr td {
    word-wrap:break-word;
    word-break:break-all;
  }
.content {
        font-size: 13px;
    }
</style>
